<?php

namespace app\common\model;

class UserWithdraw extends Base
{

    protected $createTime = 'create_time';
//    protected $updateTime = 'last_login_time';
//    protected $insert = array('status' => 1, 'reg_time');

    protected $type = array(
        'uid' => 'integer',
//        'create_time' => 'integer'
    );

    /**
     * 到账方式
     * @var array
     */
    public $withdraw_type = [
        1 => '微信',
        2 => '支付宝',
        3 => '银行卡'
    ];

    /**
     * 状态
     * @var array
     */
    public $withdraw_status = [
        1 => '财务审核中',
        2 => '提现完成',
//        3 => '用户撤销',
        4 => '财务驳回'
    ];

    /**
     * 初始化
     */
    public function initialize()
    {
        parent::initialize();
//        foreach ($this->keyList as $key => $value) {
//            if ($value['name'] == 'repayment_type') {
//                $value['option'] = $this->repayment_type;
//            }
//            if ($value['name'] == 'is_new') {
//                $value['option'] = $this->is_new;
//            }
//            if ($value['name'] == 'is_publish') {
//                $value['option'] = $this->is_publish;
//            }
//            $this->keyList[$key] = $value;
//        }
    }

    public function getWithdrawStatusNameAttr($key, $value)
    {
        return isset($this->withdraw_status[$value['withdraw_status']]) ? $this->withdraw_status[$value['withdraw_status']] : '未知';
    }

    public function getTypeNameAttr($key, $value)
    {
        return isset($this->withdraw_type[$value['type']]) ? $this->withdraw_type[$value['type']] : '未知';
    }

//withdraw_status_name


//    public $editfield = array(
//        array('name' => 'uid', 'type' => 'hidden'),
//        array('name' => 'username', 'title' => '用户名', 'type' => 'readonly', 'help' => ''),
//        array('name' => 'nickname', 'title' => '昵称', 'type' => 'text', 'help' => ''),
//        array('name' => 'password', 'title' => '密码', 'type' => 'password', 'help' => '为空时则不修改'),
//        array('name' => 'sex', 'title' => '性别', 'type' => 'select', 'option' => array('0' => '保密', '1' => '男', '2' => '女'), 'help' => ''),
//        array('name' => 'email', 'title' => '邮箱', 'type' => 'text', 'help' => '用户邮箱，用于找回密码等安全操作'),
//        array('name' => 'qq', 'title' => 'QQ', 'type' => 'text', 'help' => ''),
//        array('name' => 'score', 'title' => '用户积分', 'type' => 'text', 'help' => ''),
//        array('name' => 'signature', 'title' => '用户签名', 'type' => 'textarea', 'help' => ''),
//        array('name' => 'status', 'title' => '状态', 'type' => 'select', 'option' => array('0' => '禁用', '1' => '启用'), 'help' => ''),
//    );
//
//    public $addfield = array(
//        array('name' => 'username', 'title' => '用户名', 'type' => 'text', 'help' => '用户名会作为默认的昵称'),
//        array('name' => 'password', 'title' => '密码', 'type' => 'password', 'help' => '用户密码不能少于6位'),
//        array('name' => 'repassword', 'title' => '确认密码', 'type' => 'password', 'help' => '确认密码'),
//        array('name' => 'email', 'title' => '邮箱', 'type' => 'text', 'help' => '用户邮箱，用于找回密码等安全操作'),
//    );
//
//    public $useredit = array(
//        array('name' => 'uid', 'type' => 'hidden'),
//        array('name' => 'nickname', 'title' => '昵称', 'type' => 'text', 'help' => ''),
//        array('name' => 'sex', 'title' => '性别', 'type' => 'select', 'option' => array('0' => '保密', '1' => '男', '2' => '女'), 'help' => ''),
//        array('name' => 'email', 'title' => '邮箱', 'type' => 'text', 'help' => '用户邮箱，用于找回密码等安全操作'),
//        array('name' => 'mobile', 'title' => '联系电话', 'type' => 'text', 'help' => ''),
//        array('name' => 'qq', 'title' => 'QQ', 'type' => 'text', 'help' => ''),
//        array('name' => 'signature', 'title' => '用户签名', 'type' => 'textarea', 'help' => ''),
//    );
//
//    public $userextend = array(
//        array('name' => 'company', 'title' => '单位名称', 'type' => 'text', 'help' => ''),
//        array('name' => 'company_addr', 'title' => '单位地址', 'type' => 'text', 'help' => ''),
//        array('name' => 'company_contact', 'title' => '单位联系人', 'type' => 'text', 'help' => ''),
//        array('name' => 'company_zip', 'title' => '单位邮编', 'type' => 'text', 'help' => ''),
//        array('name' => 'company_depart', 'title' => '所属部门', 'type' => 'text', 'help' => ''),
//        array('name' => 'company_post', 'title' => '所属职务', 'type' => 'text', 'help' => ''),
//        array('name' => 'company_type', 'title' => '单位类型', 'type' => 'select', 'option' => '', 'help' => ''),
//    );

}